home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 026a / formcode.zip / PCLDRV.PRG < prev    next >
Text File  |  1991-10-27  |  26KB  |  674 lines

  1. *           Copyright (c) 1991, Micronix Inc., All rights reserved.
  2. *
  3. *   Micronix assigns you, the purchaser of this software, the right to
  4. *   distribute, free of charge, the routines in this file along with other
  5. *   code generated by FormCode/Gen as a forms package to be used only for
  6. *   printing the designed forms,etc. In other words, your end users, or whoever
  7. *   you distribute the combined forms software to, can only use the software
  8. *   in this file to print the designs that you have created for them. The
  9. *   best means of achieving this goal may be to distribute only the compiled
  10. *   version of these routines (compiled by whatever dBASE compiler you use).
  11. *   Under no circumstances should this software be distributed, whether for
  12. *   a price or not, as a stand alone libarary for general purpose use.
  13. *
  14. *   NOTE: Under no circumstances should this copyright and license notice be
  15. *   deleted from this file.
  16. *
  17. *
  18. *****************************************************************************
  19. *   This file contains all the printer driver routines. These routines
  20. *   are called by the functions that FormCode/Gen generates for your design
  21. *   namely FCGFIXOBJ, FIXVAROBJ, etc. There are two ways these routines can
  22. *   be made accesible to these procedures:
  23. *       1) By appending them to the file that contains the generated code.
  24. *          FormCode/Gen does this for you if you select the Append Procedures
  25. *          From PCLDRV option from the Page Setup dialog box.
  26. *       2) By making these routines accesible to the generated procedures by
  27. *          issuing a SET PROCEDURE TO. This is what FormCode/Gen does if you
  28. *          do not check the Append Procedures From PCLDRV check box.
  29. *
  30. *   NOTE: The routines in this library can be called directly by code that you
  31. *   write yourself also. To do this, make sure you call FCGSTART before any
  32. *   other routines and call FCGEND after printing is done. You will also
  33. *   need to declare the following global variables (use the PUBLIC statement):
  34. *       FCGRSTVAR, FCGGTOVAR, FCGLINVAR, FCGRCTVAR, FCGMOVVAR, FCGEXTVAR
  35. *  The best way to hand write code is to use generated code as a starting point.
  36. *****************************************************************************
  37.  
  38. *****************************************************************************
  39. *   Function: Initializes printer and sets up job paramets. Must be called
  40. *          before the start of a job
  41. *   Parameters: fcgcopies - (numeric) number of copies (1-99)
  42. *           fcgorient - (numeric) sheet orientation. 0 means portrait,
  43. *                one means landscape
  44. *        fcgsize - (numeric) paper size. Must be one of the following:
  45. *            1 for Executive Size (7 1/4 x 10 1/2 in)
  46. *            2 for Letter Size (8 1/2 x 11 in)
  47. *            3 for Legal Size (8 1/2 x 14 in)
  48. *               26 for A4 Size (210mm x 297mm)
  49. *               80 for Monarch Size Envelope (3 7/8 x 7 1/2 in)
  50. *               81 for COM 10 Size Envelope (4 1/8 x 9 1/2 in)
  51. *               90 for DL Size Envelope (110mm x 220mm)
  52. *               91 for C5 Size Envelope (162mm 229mm)
  53. *        fcgbin - (numeric) paper bin to use. Must be one of the following:
  54. *            1 for Upper Tray
  55. *            2 for Manual Feed
  56. *            3 for Manual Envelope Feed
  57. *            4 for Lower Tray
  58. *            5 for Paper Deck
  59. *            6 for Envelope Feeder
  60. *        fcgres - (numeric) Raster Graphics Resolution (Dots Per Inch)
  61. *            Must be one of the following values:
  62. *            75, 100, 150, 300
  63. *****************************************************************************
  64. procedure fcgstart
  65. parameters fcgcopies,fcgorient,fcgsize,fcgbin,fcgres
  66.  
  67. ?? chr(27)+"E"+chr(27)+"&l"+ltrim(str(fcgcopies))+"x"+ ;
  68.    ltrim(str(fcgorient))+"o"+ltrim(str(fcgsize))+"a4d1e42f"+ ;
  69.    ltrim(str(fcgbin))+"h"+ltrim(str(fcgres))+"R"
  70. ?? chr(27)+"*v1O"
  71. return
  72.  
  73.  
  74. *****************************************************************************
  75. *   Function: End the job by resetting the printer.
  76. *****************************************************************************
  77. procedure fcgend
  78. ?? chr(27)+"E"
  79. return
  80.  
  81.  
  82. *****************************************************************************
  83. *   Function: Sets the public variable FCGGTOVAR to PCL cursor position
  84. *             command to move cursor to specified coordinate position.
  85. *          Coordinates are specified in hundredths of inches, and point 0,0
  86. *          corresponds to the upper left corner of the physical page.
  87. *   Parameters: fcgx,fcgy - (numeric) cursor position
  88. *****************************************************************************
  89. procedure fcggoto
  90. parameters fcgx, fcgy
  91.  
  92. fcggtovar =  chr(27)+"*p"+ltrim(str(3*fcgx-75))+"x"+ltrim(str(3*fcgy-75))+"Y"
  93. return
  94.  
  95.  
  96. *****************************************************************************
  97. *   Function: Sets the public variable FCGMOVVAR to PCL cusror position command
  98. *             to move the PCL cursor horizontaly by specified relative ammount.
  99. *          Coordinates are specified in hundredths of inches, and point 0,0
  100. *          corresponds to the upper left corner of the physical page.
  101. *   Parameters: fcgx, - (numeric) ammount to move cursor by
  102. *****************************************************************************
  103. procedure fcgmovby
  104. parameters fcgx
  105.  
  106. fcgmovvar =  chr(27)+"*p+"+ltrim(str(3*fcgx))+"X"
  107. return
  108.  
  109.  
  110. *****************************************************************************
  111. *   Function: Calculates extent of text based on font metric information.
  112. *             Stores the calculated value in public variable FCGEXTVAR
  113. *   Parameters: fcgfntl,fcgfntu - (character) font metric arrays (upper/lower)
  114. *               fcgfntf - (numeric) first character in character set
  115. *               fcgstr - (character) the character string
  116. *   NOTE: The font metric information is generated by FormCode/Gen for fonts
  117. *   that need this information.
  118. *****************************************************************************
  119. procedure fcgtxtext
  120. parameters fcgfntl, fcgfntu, fcgfntf, fcgstr
  121. private fcglen, fcgidx, fcgchidx
  122.  
  123. fcgextvar = 0
  124. fcgidx = 1
  125. fcglen = len(fcgstr)
  126. do while fcgidx <= fcglen
  127.     fcgchidx = asc(substr(fcgstr,fcgidx,1)) - fcgfntf + 1
  128.     fcgextvar = fcgextvar + asc(substr(fcgfntl,fcgchidx,1)) + ;
  129.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  130.     fcgidx = fcgidx + 1
  131. *    @0,0 say fcgfntf+chr(fcgchidx+fcgfntf-1)+fcgextvar
  132. *    suspend
  133. enddo
  134. fcgextvar = int(fcgextvar / 10)
  135. return
  136.  
  137.  
  138. *****************************************************************************
  139. *   Function: Draws a verticle or horizontal line between specified points.
  140. *          Coordinates are specified in hundredths of inches, and point 0,0
  141. *          corresponds to the upper left corner of the physical page. Line
  142. *          coordinates specify center line for thick lines.
  143. *   Parameters: fcgx1,fcgy1 - (numeric) line starting position
  144. *        fcgx2,fcgy2 - (numeric) line ending position
  145. *        fcgthick - (numeric) line width in hundredths of inches
  146. *   NOTE: The ending position must specify coordinates that are larger than
  147. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  148. *****************************************************************************
  149. procedure fcgline
  150. parameters fcgx1, fcgy1, fcgx2, fcgy2, fcgthick
  151. private fcgposx,fcgposy,fcgsizex,fcgsizey,fcgtmp
  152.  
  153. if fcgx1 = fcgx2
  154.     fcgposx = fcgx1 - int(fcgthick/2)
  155.     fcgposy = fcgy1
  156.     fcgsizex = fcgthick
  157.     fcgsizey = fcgy2 - fcgy1 + 1
  158. else
  159.     fcgposy = fcgy1 - int(fcgthick/2)
  160.     fcgposx = fcgx1
  161.     fcgsizey = fcgthick
  162.     fcgsizex = fcgx2 - fcgx1 + 1
  163. endif
  164.  
  165. do fcggoto with fcgposx,fcgposy
  166. ?? fcggtovar+chr(27)+"*c"+ltrim(str(3*fcgsizex))+"a" + ;
  167.    ltrim(str(3*fcgsizey))+"b0P"
  168. return
  169.  
  170.  
  171. *****************************************************************************
  172. *   Function: Draws a rectangle with or without a border and with or without a
  173. *             fill. Coordinates are specified in hundredths of inches, and
  174. *             point 0,0 corresponds to the upper left corner of the physical page.
  175. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  176. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  177. *        fcgthick - (numeric) border width in hundredths of inches
  178. *        fcgfillt - (numeric) fill type. Must be one of the following:
  179. *            0 for black fill
  180. *            1 for white fill
  181. *            2 for HP defined gray shading pattern
  182. *            3 for HP defined cross-hatched pattern
  183. *                       4 for no fill
  184. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  185. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  186. *            for fcgfillt = 2, a gray shading percentage value from
  187. *            the following (2,10,15,30,45,70,90,100)
  188. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  189. *                       to the six predefined patterns.
  190. *   NOTE: The ending position must specify coordinates that are larger than
  191. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  192. *****************************************************************************
  193. procedure fcgrect
  194. parameters fcgleft,fcgtop,fcgright,fcgbot,fcgthick,fcgfillt,fcgfillp
  195.  
  196. if fcgfillt <> 4
  197.     do fcggoto with fcgleft, fcgtop
  198. ?? fcggtovar+chr(27)+"*c"+ltrim(str(fcgfillp))+"g"+;
  199.    ltrim(str((fcgright-fcgleft+1)*3))+"a"+ltrim(str((fcgbot-fcgtop+1)*3))+"b"+;
  200.    ltrim(str(fcgfillt))+"P"
  201. endif
  202.  
  203. if fcgthick > 0
  204.     do fcgline with fcgleft,fcgtop,fcgright,fcgtop,fcgthick
  205.     do fcgline with fcgleft,fcgbot,fcgright,fcgbot,fcgthick
  206.     do fcgline with fcgleft,fcgtop-int(fcgthick/2),fcgleft, ;
  207.             fcgbot+int((fcgthick-1)/2),fcgthick
  208.     do fcgline with fcgright,fcgtop-int(fcgthick/2),fcgright, ;
  209.             fcgbot+int((fcgthick-1)/2),fcgthick
  210. endif
  211. return
  212.  
  213.  
  214. *****************************************************************************
  215. *   Function: Draws a box with specified border width, type, sahdow, etc.
  216. *          Coordinates are specified in hundredths of inches, and point 0,0
  217. *          corresponds to the upper left corner of the physical page.
  218. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  219. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  220. *        fcgthick - (numeric) border width in hundredths of inches
  221. *        fcgfillt - (numeric) fill type. Must be one of the following:
  222. *            0 for black fill
  223. *            1 for white fill
  224. *            2 for HP defined gray shading pattern
  225. *            3 for HP defined cross-hatched pattern
  226. *                       4 for no fill
  227. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  228. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  229. *            for fcgfillt = 2, a gray shading percentage value from
  230. *            the following (2,10,15,30,45,70,90,100)
  231. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  232. *                       to the six predefined patterns.
  233. *        fcgborder - (numeric) if = 0, specifies a single border. If = 1
  234. *            specifies a double border.
  235. *        fcgshadow - (numeric) if = 0, specifies no shadow. If = 1
  236. *            specifies a shadow.
  237. *   NOTE: The ending position must specify coordinates that are larger than
  238. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  239. *****************************************************************************
  240. procedure fcgbox
  241. parameters fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgbfillt, ;
  242.     fcgbfillp, fcgbborder, fcgbshadow
  243. private fcgbmargin,fcgft
  244.  
  245. fcgft = fcgbfillt
  246. fcgbmargin = 2 * fcgbthick
  247. if fcgbborder = 1
  248.     do fcgrect with fcgbleft+fcgbmargin, fcgbtop+fcgbmargin, fcgbright-fcgbmargin, ;
  249.     fcgbbot-fcgbmargin, fcgbthick, fcgft, fcgbfillp
  250.     fcgft = 4
  251. endif
  252.  
  253. do fcgrect with fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgft, fcgbfillp
  254.  
  255. if fcgbshadow = 1
  256.     do fcgrect with fcgbleft+5-int(fcgbthick/2), fcgbbot+int(fcgbthick/2), ;
  257.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  258.     do fcgrect with fcgbright+int(fcgbthick/2), fcgbtop+5-int(fcgbthick/2), ;
  259.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  260. endif
  261. return
  262.  
  263.  
  264. *****************************************************************************
  265. *   Function: Prints left justified text at specified position
  266. *   Parameters:
  267. *    fcgfnts - (character) Font selection string
  268. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  269. *    fcgtext - (numeric) The text string to print
  270. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  271. *                           parametrs are interpreted the same as in FCGBOX
  272. *       fcgundlin - (logical) text is underlined if true
  273. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  274. *****************************************************************************
  275. procedure fcgltxt
  276. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgundlin
  277.  
  278. if len(fcgtext) = 0
  279.     return
  280. endif
  281.  
  282. do fcggoto with fcgtlft, fcgttop
  283. ?? fcgfnts+fcggtovar
  284.  
  285. if fcgfillt <> 0
  286.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  287. endif
  288. if fcgundlin
  289.     ?? chr(27)+"&d0D"
  290. endif
  291.  
  292. ?? fcgtext
  293. if fcgfillt <> 0
  294.    ?? chr(27)+"*v0T"
  295. endif
  296. if fcgundlin
  297.     ?? chr(27)+"&d@"
  298. endif
  299.  
  300. return
  301.  
  302.  
  303. *****************************************************************************
  304. *   Function: Prints L/R justified single line text at specified position
  305. *   Parameters:
  306. *    fcgfnts - (character) Font selection string
  307. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  308. *    fcgtext - (numeric) The text string to print
  309. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  310. *                            parametrs are interpreted the same as in FCGBOX
  311. *       fcgundline - (logical) text is underlined if true
  312. *    fcgbrkxtra - (numeric) The break extra ammount to spread in breaks
  313. *    fcgbrkcnt - (numeric) The number of break characters in string
  314. *    fcgbrkch - (numeric) The actual break character for symbol set
  315. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  316. *****************************************************************************
  317. procedure fcglrstxt
  318. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgundlin, ;
  319.     fcgbrkxtra, fcgbrkcnt, fcgbrk
  320. private fcgbrkamt, fcgbrkrm, fcgstpos, fcgtmpstr, fcgbrkch, fcgamt, fcgcurch
  321. private fcgstrlen
  322.  
  323. if len(fcgtext) = 0
  324.     return
  325. endif
  326.  
  327. fcgbrkch = chr(fcgbrk)
  328. if fcgbrkcnt <> 0
  329.     fcgbrkamt = int(fcgbrkxtra/fcgbrkcnt)
  330.     fcgbrkrm = int(fcgbrkxtra - (fcgbrkamt * fcgbrkcnt))
  331. endif
  332. fcgstrlen = len(fcgtext)
  333. fcgstpos = 1
  334. do fcggoto with fcgtlft, fcgttop
  335. ?? fcgfnts+fcggtovar
  336. fcgtmpstr = ""
  337. do while fcgstpos <= fcgstrlen
  338.     fcgcurch = substr(fcgtext,fcgstpos,1)
  339.     if fcgcurch = fcgbrkch
  340.         fcgamt = fcgbrkamt
  341.     if fcgbrkrm > 0
  342.         fcgamt = fcgamt + 1
  343.         fcgbrkrm = fcgbrkrm - 1
  344.     endif
  345.         if fcgamt > 0
  346.         do fcgmovby with fcgamt
  347.         endif
  348.     endif
  349.     if fcgcurch = fcgbrkch .AND. fcgamt > 0
  350.         fcgtmpstr = fcgtmpstr + fcgcurch + fcgmovvar
  351.     else
  352.         fcgtmpstr = fcgtmpstr + fcgcurch
  353.     endif
  354.     fcgstpos = fcgstpos + 1
  355. enddo
  356. if fcgfillt <> 0
  357.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  358. endif
  359. if fcgundlin
  360.     ?? chr(27)+"&d0D"
  361. endif
  362.  
  363. ?? fcgtmpstr
  364.  
  365. if fcgfillt <> 0
  366.    ?? chr(27)+"*v0T"
  367. endif
  368. if fcgundlin
  369.     ?? chr(27)+"&d@"
  370. endif
  371. return
  372.  
  373.  
  374. *****************************************************************************
  375. *   Function: Prints multi line L/R justified dynamic text at specified position
  376. *   Parameters:
  377. *    fcgfnts - (character) Font selection string
  378. *    fcgtlft, fcgttop - (numeric) center position of string
  379. *    fcgtext - (numeric) The text string to print
  380. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  381. *                           parameters are interpreted the same as in FCGBOX
  382. *       fcgundlin - (logical) text is underlined if true
  383. *       fcgfntl, fcgfntu - (character) text metric arrays
  384. *       fcgfntf - (numeric) first character position in character set
  385. *       fcgfnth - (numeric) font height
  386. *       fcgfntbrk - (numeric) ascii value of the font break character
  387. *       fcgextent - (numeric) text extent in hundredths of inches
  388. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  389. *****************************************************************************
  390. procedure fcglrtxt
  391. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgundlin, ;
  392.     fcgfntl, fcgfntu, fcgfntf, fcgfnth, fcgfntbrk, fcgextent
  393. private fcgcurpos, fcgendpos, fcgtmp, fcgword, fcgstrlen, fcgcurch, fcgbrkch
  394. private fcgcurext, fcgwrdext, fcgchidx, fcgbrkext, fcgspxtra, fcgbrkcnt, fcgdone, ;
  395.         fcglinend
  396.  
  397. if len(fcgtext) = 0
  398.     return
  399. endif
  400.  
  401. fcgcurpos = 1
  402. fcgcurext = 0
  403. fcgbrkcnt = 0
  404. fcgextent = fcgextent * 10
  405. fcgtmp = ""
  406. fcgstrlen = len(fcgtext)
  407. fcgbrkch = chr(fcgfntbrk)
  408. fcgdone = .F.
  409. fcgbrkext = asc(substr(fcgfntl,fcgfntbrk-fcgfntf+1,1)) + ;
  410.         (asc(substr(fcgfntu,fcgfntbrk-fcgfntf+1,1))-1) * 256
  411. do fcggoto with fcgtlft, fcgttop
  412. ?? fcgfnts+fcggtovar
  413. if fcgfillt <> 0
  414.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  415. endif
  416. if fcgundlin
  417.     ?? chr(27)+"&d0D"
  418. endif
  419. do while .T.
  420. *    suspend
  421.     do while fcgcurpos <= fcgstrlen
  422.         fcgcurch = substr(fcgtext,fcgcurpos,1)
  423.         if fcgcurch <>  fcgbrkch
  424.             exit
  425.         endif
  426.         fcgcurpos = fcgcurpos + 1
  427.     enddo
  428.     fcgendpos = fcgcurpos
  429.     fcgwrdext = 0
  430.     do while fcgendpos <= fcgstrlen
  431.         fcgcurch = substr (fcgtext,fcgendpos,1)
  432.         if fcgcurch = fcgbrkch .OR. fcgcurch = chr(13) .OR. fcgcurch = chr(10)
  433.             exit
  434.         endif
  435.         fcgchidx = asc(fcgcurch) - fcgfntf + 1
  436.         fcgwrdext = fcgwrdext + asc(substr(fcgfntl,fcgchidx,1)) + ;
  437.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  438.         fcgendpos = fcgendpos + 1
  439.     enddo
  440.     if fcgcurext = 0
  441.         fcgspxtra = 0
  442.     else
  443.         fcgspxtra = fcgbrkext
  444.     endif
  445.     if (fcgcurext + fcgwrdext + fcgspxtra <= fcgextent) .OR. ;
  446.         (fcgcurext = 0 .AND. fcgwrdext >= fcgextent)
  447.         if fcgcurext <> 0
  448.             fcgtmp = fcgtmp + fcgbrkch
  449.             fcgbrkcnt = fcgbrkcnt + 1
  450.             fcgcurext = fcgcurext + fcgbrkext
  451.         endif
  452.         fcgtmp = fcgtmp + substr(fcgtext,fcgcurpos,fcgendpos-fcgcurpos)
  453.         if fcgcurch = chr(10) .OR. fcgcurch = chr(13)
  454.             fcglinend = .T.
  455.         else
  456.             fcglinend = .F.
  457.         endif
  458. *        @3, 5 say fcgtmp + "    CurCh["+fcgcurch+"]"
  459. *        suspend
  460.         fcgcurext = fcgcurext + fcgwrdext
  461.         fcgcurpos = fcgendpos + 1
  462.         if fcgcurch = chr(13) .AND. fcgcurpos <= fcgstrlen .AND. substr(fcgtext,fcgcurpos,1) = chr(10)
  463.             fcgcurpos = fcgcurpos + 1
  464.         endif
  465.     else
  466.         fcglinend = .F.
  467.         fcgdone = .T.
  468.     endif
  469.     if fcgcurext >= fcgextent .OR. fcglinend .OR. fcgcurpos > fcgstrlen .OR. fcgdone
  470. *        clear
  471. *        @4,5 say fcgtmp
  472. *        @6,5 say str(fcgextent,6)+str(fcgcurext,6)+str(fcgbrkcnt,6)
  473. *        @7,5 say "CurCh["+fcgcurch+"]  Pos: "+str(fcgcurpos,4)+"  Len: "+str(fcgstrlen,4)
  474. *        suspend
  475.         if fcgcurpos > fcgstrlen .OR. fcglinend
  476.         do fcgltxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0, .F.
  477.     else
  478.         do fcglrstxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0, .F., ;
  479.             (fcgextent-fcgcurext)/10, fcgbrkcnt, fcgfntbrk
  480.         endif
  481.         fcgdone = .F.
  482.         fcgcurext = 0
  483.         fcgtmp = ""
  484.         fcgbrkcnt = 0
  485.         fcgttop = fcgttop + fcgfnth
  486.         if fcgcurpos > fcgstrlen
  487.             exit
  488.         endif
  489.     endif
  490. enddo
  491.  
  492. if fcgfillt <> 0
  493.    ?? chr(27)+"*v0T"
  494. endif
  495. if fcgundlin
  496.     ?? chr(27)+"&d@"
  497. endif
  498. return
  499.  
  500.  
  501. *****************************************************************************
  502. *   Function: Prints center justified text at specified position
  503. *   Parameters:
  504. *    fcgfnts - (character) Font selection string
  505. *    fcgtcnt, fcgttop - (numeric) center position of string
  506. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  507. *                           parameters are interpreted the same as in FCGBOX
  508. *       fcgundlin - (logical) text is underlined if true
  509. *    fcgtext - (numeric) The text string to print
  510. *       fcgfntl, fcgfntu - (character) text metric arrays
  511. *       fcgfntf - (numeric) first character position in character set
  512. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  513. *****************************************************************************
  514. procedure fcgctxt
  515. parameters fcgfnts, fcgtcnt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgundlin, ;
  516.     fcgfntl, fcgfntu, fcgfntf
  517. private fcgtmp
  518.  
  519. if len(fcgtext) = 0
  520.     return
  521. endif
  522.  
  523. fcgtmp = trim(fcgtext)
  524. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  525. fcgtcnt = fcgtcnt - fcgextvar/2
  526. do fcggoto with fcgtcnt, fcgttop
  527. ?? fcgfnts+fcggtovar
  528.  
  529. if fcgundlin
  530.     ?? chr(27)+"&d0D"
  531. endif
  532. if fcgfillt <> 0
  533.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  534. endif
  535.  
  536. ?? fcgtmp
  537.  
  538. if fcgfillt <> 0
  539.    ?? chr(27)+"*v0T"
  540. endif
  541. if fcgundlin
  542.     ?? chr(27)+"&d@"
  543. endif
  544. return
  545.  
  546. *****************************************************************************
  547. *   Function: Prints right justified text at specified position
  548. *   Parameters:
  549. *    fcgfnts - (character) Font selection string
  550. *    fcgtrt, fcgttop - (numeric) center position of string
  551. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  552. *                           parameters are interpreted the same as in FCGBOX.
  553. *       fcgundlin (logical) text is underlined if true
  554. *    fcgtext - (numeric) The text string to print
  555. *       fcgfntl, fcgfntu - (character) text metric arrays
  556. *       fcgfntf - (numeric) first character position in character set
  557. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  558. *****************************************************************************
  559. procedure fcgrtxt
  560. parameters fcgfnts, fcgtrt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgundlin, ;
  561.     fcgfntl, fcgfntu, fcgfntf
  562. private fcgtmp
  563.  
  564. if len(fcgtext) = 0
  565.     return
  566. endif
  567.  
  568. fcgtmp = trim(fcgtext)
  569. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  570. fcgtrt = fcgtrt - fcgextvar
  571. do fcggoto with fcgtrt, fcgttop
  572. ?? fcgfnts+fcggtovar
  573.  
  574. if fcgfillt <> 0
  575.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  576. endif
  577. if fcgundlin
  578.     ?? chr(27)+"&d0D"
  579. endif
  580.  
  581. ?? fcgtmp
  582.  
  583. if fcgfillt <> 0
  584.    ?? chr(27)+"*v0T"
  585. endif
  586. if fcgundlin
  587.     ?? chr(27)+"&d@"
  588. endif
  589. return
  590.  
  591. *****************************************************************************
  592. *   Function: Defines printer macro with specified ID
  593. *   Parameters:
  594. *    fcgmacid - (character) macro id
  595. *****************************************************************************
  596. procedure fcgdefmac
  597. parameters fcgmacid
  598. ?? chr(27)+"&f"+fcgmacid+"y0X"
  599. return
  600.  
  601. *****************************************************************************
  602. *   Function: Ends definition for a printer macro
  603. *   Parameters: none
  604. *****************************************************************************
  605. procedure fcgendmac
  606. ?? chr(27)+"&f1X"
  607. return
  608.  
  609. *****************************************************************************
  610. *   Function: Executes printer macro with last ID
  611. *   Parameters: none
  612. *****************************************************************************
  613. procedure fcgdomac
  614. parameters fcgmacid
  615. ?? chr(27)+"&f2X"
  616. return
  617.  
  618. *****************************************************************************
  619. *   Function: Draws check box at specified location
  620. *   Parameters: fcgleft, fcgtop (numeric) top left corner of box
  621. *               fcgcheck (logical) check box checked or not ?
  622. *****************************************************************************
  623. procedure fcgchkbox
  624. parameters fcgleft, fcgtop, fcgcheck
  625. do fcgrect with fcgleft, fcgtop, fcgleft+15, fcgtop+15, 1, 4, 0
  626. if .NOT. fcgcheck
  627.     return
  628. endif
  629.  
  630. do fcggoto with fcgleft+1, fcgtop+1
  631. fcgbitmap = fcggtovar+chr(27)+"*t75R"+chr(27)+"*r11t11s1A"+chr(27)+"*b0M"
  632. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  633. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  634. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  635. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  636. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  637. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(4)
  638. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  639. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  640. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  641. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  642. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  643. ?? fcgbitmap+chr(27)+"*rB"
  644. return
  645.  
  646.  
  647. *****************************************************************************
  648. *   Function: Draws bitmap image at specified position
  649. *   Parameters: fcgleft, fcgtop (numeric) top left corner of image
  650. *               fcgname (character) name of bitmap file (must be in curr dir)
  651. *   WARNING: This function uses the DOS COPY command (with the /b switch for
  652. *   binary data) to copy the bitmap file to the printer. On systems other than
  653. *   DOS (e.g Novel, Unix, etc) this needs to be changed. Also the file is
  654. *   copied to standard printer PRN. If your printer is connected to a different
  655. *   port you need to change this also !!!
  656. *****************************************************************************
  657. procedure fcgimage
  658. parameters fcgleft, fcgtop, fcgname
  659.  
  660. * The following lines are dummy lines. They must be deleted by the user.
  661. * Their only porpose is to serve as a reminder for the new user
  662. clear
  663. @12, 10 say "PCLDRV.PRG has not been modified as described in the users manual."
  664. @13, 10 say "Please read the section on Printing Bitmaps to acomplish this."
  665. return
  666.  
  667. do fcggoto with fcgleft, fcgtop
  668. ?? fcggtovar
  669. * The next line should be changed so that it copies the file &fcgname to
  670. * your printer port. The copy command works for DOS but may need to be
  671. * changed for other systems such as Unix, Novel, etc.
  672. run copy /b &fcgname prn
  673. return
  674.